<div class="pageContent">
	
	<form method="post" action="/index.php?act=message&st=messageEdit" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
		<input type="hidden" name="id" value="{$info.id}" />
		<div class="pageFormContent" layoutH="58">

			<div class="unit">
				<label>规则名称：</label>
				<input type="text" name="rule_name" size="30" class="required" value="{$info.rule_name}" errormsg="请输入规则名称"/>
			</div>
			<div class="unit">
				<label>关键字：</label>
				<textarea class="required" name="keywords" cols="40" rows="6" errormsg="请输入关键字">{$info.keywords}</textarea>
				<span class="info">&nbsp;&nbsp;关键字以 # 分割</span>
			</div>
			<div class="unit">
				<dl>
					<label>关键字导入：</label>
					<dd>
						<input type="file" id="uploadify" class="input-xlarge" name="uploadify">	
					</dd>
				</dl>
				<br/><br/><br/><br/>
			</div>
			<div class="unit">
				<label>回复：</label>
				<textarea class="required" name="message" cols="40" rows="6" errormsg="请输入消息回复">{$info.message}</textarea>
			</div>
			
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
	
</div>

<script type="text/javascript">
$(function() {
    $('#uploadify').uploadify({
        'buttonText'      	: '.xls或.xlsx 文件',
        'swf'      			: '{$host}/files/js/uploadify/uploadify.swf',
        'uploader' 			: '{$host}/index.php?act=message&st=parse_xls',
        'cancelImg'			: '{$host}/files/js/uploadify/uploadify-cancel.png',
        'auto' 				: true,
		'fileTypeExts'		: '.xls;.xlsx;',
		'fileTypeDesc'		: '请选择 .xls或.xlsx 文件',
		'buttonCursor'      : 'pointer',
        'onUploadSuccess' 	: function(file, data, response) {
			var data = eval('('+data+')');
			var json = {"statusCode":200,"message":"操作成功","callbackType":"","navTabId":"","forwardUrl":""};
            if(data['state'] == 'SUCCESS'){
				if(!data['text']){
					json.statusCode = 300;
					json.message = "操作失败,上传文件为空";
				}
				$("textarea[name=keywords]").val(data['text']);
            }else{
				json.statusCode = 300;
				json.message = data['message'];
            }
			dialogAjaxDone(json);
        }
    });
});
</script>